#include "MovieRegister.h"
#include "Movie.h"
#include <sstream>
#include <iostream>
#include <string>

MovieRegister::MovieRegister()
{
}

void MovieRegister::WriteToFile(Movie w)
{
	ofstream txt;
	txt.open("text.txt");
	txt << w << endl;
	txt.close();
}

void MovieRegister::ReadFromFile()
{
	string STRING;
	ifstream txt;
	txt.open("text.txt");
	txt >> STRING;
	cout << STRING;
	txt.close();
}

void MovieRegister::Add(Movie a)
{
	v.push_back(a);
	
}



void MovieRegister::Delete(int i)
{
	v.erase(v.begin() + i);
}

string MovieRegister::List()
{
	ostringstream oss;
	for (int i = 0; i < v.size(); i++)
		oss << v[i] << endl;

	return oss.str();
}

MovieRegister::~MovieRegister()
{
}
